package page;

import java.rmi.server.UID;
import java.sql.SQLException;

import dao.DAOdeliver;
import dao.DAOentry;
import dao.DAOgood;
import dao.DAOinventory;
import dao.DAOuaccount;
import entity4wms.Deliver;
import entity4wms.Entry;

public final class SubMenu {

    public static void exitMenu(){
        System.out.println("退出系统");
        System.exit(1);

    }
   
    public static void menuGood(String[] items) throws SQLException, ClassNotFoundException{
        String choice =printPage.mainMenu(items);
        switch (Integer.parseInt(choice)){ 
            case 0 -> MainPage.mainMenu();
            case 1 -> printPage.addGood();
            case 2 -> printPage.editGood();
            case 3 -> printPage.deleteGood();
            case 4 -> DAOgood.queryGoods();
            default -> System.out.println("输入有误");

                
        }
    }

    public static void menuAccount(String[] items) throws SQLException, ClassNotFoundException{
        String choice =printPage.mainMenu(items);
        switch (Integer.parseInt(choice)){ 
            case 0 -> MainPage.mainMenu();
            case 1 -> printPage.addUaccount(); 
            case 2 -> printPage.editUaccount();
            case 3 -> printPage.deleteUaccount();
            case 4 -> DAOuaccount.queryUaccount();
            default -> System.out.println("输入有误");

                
        }
    }
     public static void menuDelivered(String[] items, Integer userID) throws SQLException, ClassNotFoundException{
        String choice =printPage.mainMenu(items);
        switch (Integer.parseInt(choice)){ 
            case 0 -> MainPage.mainMenu();
            case 1 -> printPage.addDeliver(userID);
            case 2 -> printPage.editDeliver(userID);
            case 3 -> printPage.delDeliver();
            case 4 -> DAOdeliver.queryDeliver(new Deliver());
            default -> System.out.println("输入有误");

                
        }
    }

    public static void menuEntry(String[] items,Integer userID) throws SQLException, ClassNotFoundException{
        System.out.println("用户号为："+ userID);
        String choice =printPage.mainMenu(items);
        switch (Integer.parseInt(choice)){ 
            case 0 -> MainPage.mainMenu();
            case 1 -> printPage.addEntry(userID);
            case 2 -> printPage.editEntry(userID);
            case 3 -> printPage.delEntry();
            case 4 -> DAOentry.queryEntry(new Entry());
            default -> System.out.println("输入有误");

                
        }
    }

    public static void menuInvertory(String[] items) throws SQLException, ClassNotFoundException{
        String choice =printPage.mainMenu(items);
        switch (Integer.parseInt(choice)){ 
            case 0 -> MainPage.mainMenu();
            case 1 -> System.out.println("1");
            case 2 -> System.out.println("2");
            case 3 -> System.out.println("3");
            case 4 -> DAOinventory.queryInventory();
            default -> System.out.println("输入有误");

                
        }
    }

}
